{extend name="layout/layout" /}

{block name="content"}
<div class="row">
    <div class="col-lg-12">
        <div class="box box-success">
            <div class="box-header with-border">
                <h3 class="box-title">订单配置</h3>
            </div>
            <div class="box-body">
				<form id="form_address_add" class="form-horizontal form">
					<div class="form-body">
						<div class="row">
							<div class="form-group">
								<lable class="col-md-3 control-label">
									<span class="txt_red">*</span> <span class="txt_no">未付款订单多久后失效：</span>
								</lable>
								<div class="col-md-6">
									<select name="invalid_time" class="form-control">
										<option value="0">请选择</option>
										<option value="1" {if condition="$invalid_time ==1"}selected{/if}>15分钟后</option>
										<option value="2" {if condition="$invalid_time ==2"}selected{/if}>30分钟后</option>
										<option value="3" {if condition="$invalid_time ==3"}selected{/if}>1小时后</option>
										<option value="4" {if condition="$invalid_time ==4"}selected{/if}>3小时后</option>
										<option value="5" {if condition="$invalid_time ==5"}selected{/if}>1天后</option>
										<option value="6" {if condition="$invalid_time ==6"}selected{/if}>2天后</option>
										<option value="7" {if condition="$invalid_time ==7"}selected{/if}>3天后</option>
									</select>
								</div>
							</div>
						</div>

						<div class="row">
							<div class="form-group">
								<lable class="col-md-3 control-label">
									<span class="txt_red">*</span> <span class="txt_no">已发货订单多久后自动确认收货：</span>
								</lable>
								<div class="col-md-6">
									<select name="confirm_time" class="form-control">
										<option value="0">请选择</option>
										<option value="1" {if condition="$confirm_time ==1"}selected{/if}>7天后</option>
										<option value="2" {if condition="$confirm_time ==2"}selected{/if}>15天后</option>
										<option value="3" {if condition="$confirm_time ==3"}selected{/if}>20天后</option>
										<option value="4" {if condition="$confirm_time ==4"}selected{/if}>30天后</option>
									</select>
								</div>
							</div>
						</div>

						<input type="hidden" name="tenantId" value="{$tenantId}" />
						<hr />

						<div class="form-actions">
							<div class="row">
								<div class="col-md-12">
									<div class="form-group">
										<label class="col-md-3 control-label"></label>
										<div class="col-md-9">
											<button type="button" id="sava_add" class="btn btn-primary">
												保存 <i class="fa fa-floppy-o"></i>
											</button>
											<button type="button" id="btn_cancle" class="btn btn-default" onclick="history.go(-1);">
												返回 <i class="fa fa-mail-forward"></i>
											</button>
											<span class="help-block "></span>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</form>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/js/include.js" type="text/javascript"></script>
<script type="text/javascript">
    $("#sava_add").click(function () {
        var _data = $("#form_address_add").serializeObject();
        if(_data.invalid_time == 0){
            layer.msg('请选择', {icon: 5, time: 3000});
            return;
        }
        if(_data.confirm_time == 0){
            layer.msg('请选择', {icon: 5, time: 3000});
            return;
        }else {
            $.ajax({
                url : '/admin/Orderconfig/index',
                type : 'post',
                dataType : 'json',
                contentType:"application/json; charset=utf-8",
                async: false,
                data : JSON.stringify(_data),
            }).done(function(r) {
                if (r.status == '1') {
                    layer.msg(r.message, {icon: 6, time: 3000});
                    $('#myModal2').modal('hide');
                } else if (r.status == '0') {
                    layer.msg(r.message, {icon: 5, time: 3000});
                    $('#myModal2').modal('hide');
                }
            });
        }

    });
</script>
{/block}